home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4611 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  721 b 

  1. From: Tendrils@msn.com (kelvin  )
  2. Subject: RE: Beginner: How to #include
  3. Date: 31 Jan 96 09:13:34 -0800
  4. References: <west.32.008AC8C0@emt.e-technik.tu-muenchen.de>
  5. Message-ID: <00001a81+0000973a@msn.com>
  6. Path: news.msn.com!msn.com
  7. Newsgroups: comp.lang.c++
  8. Organization: The Microsoft Network (msn.com)
  9.  
  10. Generally, it is best to put #includes in .cpp files
  11.  
  12. my_data.h:
  13. ----------
  14. class CPicture; // forward declaration
  15.  
  16. class A
  17. {
  18. ..
  19. CPicture m_picture;
  20. ...
  21. }
  22.  
  23.  
  24.  
  25. my_program.cpp:
  26. ---------------
  27. #include "my_data.h"
  28.  
  29. Also,
  30.  
  31. it is a very good practice to put the following two statements
  32. at the top of the .h file
  33.  
  34. #ifndef _MY_DATA_H_
  35. #define _MY_DATA_H_
  36.  
  37. and the following statement at the last line of the .h file
  38. #endif
  39.